(library (templates helpers)
  (export templatize)
  (import
    (except (rnrs base) let-values error)
    (only (guile) lambda* λ)
    ;; standard web library
    (web request)
    (web response)
    (web uri)))


(define templatize
  (lambda (title body)
    "Wrap the usual stuff around the SXML of the body."
    `(html (head (title ,title)
                 (link (@ (rel "stylesheet")
                          (type "text/css")
                          (href "/static/css/style.css")))
                 (link (@ (rel "stylesheet")
                          (type "text/css")
                          (href "/static/css/nav.css"))))
           ;; Splice in the body. It could be multiple top
           ;; level expressions inside the body.
           (body ,@body))))
